package com.sloera.jvm.oom;

import java.util.Random;

/**
 * @author sloera
 * @create 2020/5/3
 * -Xms10m -Xmx10m
 * Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
 */
public class JavaHeapSpaceDemo {
    public static void main(String[] args) {
        String str = "str";
        while (true) {
            str += str + new Random().nextInt(1111111) + new Random().nextInt(222222);
            str.intern();
        }
    }
}
